package com.pdf.utils;
/*
 *@ClassName: TimeUtil
 *@Description: TODO
 *@author: 郑波
 *@date: 2019-04-13 20:54
 *@version: 1.0
 */

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

public class TimeUtil {
    public static String getCurTime(){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyyMMdd");
        String dateTime=LocalDateTime.now(ZoneOffset.of("+8")).format(formatter);
        return dateTime;
    }
    public static String getCurSecond(){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        String secondTime=LocalDateTime.now(ZoneOffset.of("+8")).format(formatter);
        return secondTime;
    }

    //测试用
    public static void main(String[] args) {
        System.out.println(getCurTime());
        System.out.println(getEndTime(5));
        System.out.println(getCurSecond());
    }

    public static String getEndTime(Integer days){
        String curTime = getCurTime();
        Integer endTime = Integer.valueOf(curTime)+days;
        return String.valueOf(endTime);
    }
}
